package cn.com.zhuxulin.info.Utils;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

public final class IOUtils {
	public static String getXmlString(InputStream in) throws UnsupportedEncodingException, IOException{
		return new String(getBytes(in),"UTF-8");
	}
	public static byte[] getBytes(InputStream in) throws IOException{
		byte b[]=new byte[1024];
		ByteArrayOutputStream out=new ByteArrayOutputStream();
		while(in.read(b)!=-1){
			out.write(b);
		}
		return out.toByteArray();
	}
	public static String BytesToString(byte[] bs,String encoding) throws UnsupportedEncodingException{
		return new String(bs, encoding);
	}
}
